using System;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BaseForum.Mockup;
using BaseForum.Model;
using BaseForum.Dao;

namespace WebForum.App_Data
{
    public class DoctorDataSource
    {
        private static readonly DoctorDao doctorDao = new DoctorDao();
        /// <summary>
        /// Get all Doctors
        /// </summary>
        /// <returns></returns>
        public static List<Doctor> ListDoctors()
        {
            //List<Doctor> doctors = WebForumMockup.doctors;
            //return doctors;
            return doctorDao.List();
        }
        /// <summary>
        /// Insert new doctor
        /// </summary>
        /// <param name="doctor"></param>
        /// <returns></returns>
        public static bool Insert(Doctor doctor)
        {
            //WebForumMockup.doctors.Add(doctor);
            //return doctor;
            return doctorDao.Insert(doctor);
        }
        /// <summary>
        /// Get doctor by user name - not use
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public static Doctor Get(String userName)
        {
            foreach (Doctor d in WebForumMockup.doctors)
            {
                if (userName == d.UserName)
                    return d;
            }
            return null;
        }
        /// <summary>
        /// Get
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Doctor Get(Int32 id)
        {
            return doctorDao.Get(id);
        }
        /// <summary>
        /// Search doctor
        /// </summary>
        /// <param name="w"></param>
        /// <param name="s"></param>
        /// <param name="e"></param>
        /// <param name="a"></param>
        /// <returns></returns>
        public static List<Doctor> FindDoctor(String w,String s,String e,String a)
        {
            Doctor doctor = new Doctor();
            doctor.Workplace = w;
            doctor.Specialization = s;
            doctor.Experience = e;
            doctor.Achievement = a;
            return doctorDao.FindDoctor(doctor);
        }
        /// <summary>
        /// Update
        /// </summary>
        /// <param name="doctor"></param>
        /// <returns></returns>
        public static bool Update(Doctor doctor)
        {
            return doctorDao.Update(doctor);
        }
    }
}
